package com.platform.vo;

import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import lombok.Data;

import java.util.List;
import java.util.Map;

/**
 * Excel 导出配置
 * @author Tommy
 */

@Data
public class ExcelCfgDto {
    public static final Integer DEFAULT_SHEET_NUM = 0;
    public static final Integer DEFAULT_TITLE_ROW_NUM = 0;
    public static final Integer DEFAULT_FIRST_ROW_NUM = 0;
    public static final Integer DEFAULT_FIRST_COL_NUM = 0;

    private String sheetName;
    private String tableName;
    private Integer sheetNum;
    private Integer titleRowNum;
    private Integer firstRowNum=0;
    private Integer firstColNum=0;
    private List<ExcelColCfgDto> columns = Lists.newArrayList();

    private Map<String, Object> context = Maps.newHashMap();

    public static ExcelCfgDto of(){
        return new ExcelCfgDto();
    }

    public void initFields(String... fields){
        for (String field : fields) {
            columns.add(ExcelColCfgDto.of(field));
        }
    }
}
